* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.main-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.input-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    border-top: 5px solid #667eea;
}

.input-section h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.4rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

/* 横向排列的表单组 */
.form-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.form-row .form-group {
    margin-bottom: 0;
}

/* 4列布局的表单组（用于阶梯贷设置） */
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row-2 .form-group {
    margin-bottom: 0;
}

/* 按钮组样式 */
.button-group {
    display: flex;
    align-items: end;
    padding-top: 28px; /* 补偿标签的高度，使按钮与输入框底部对齐 */
}

.button-group .btn {
    width: 100%;
    height: 48px; /* 与输入框高度保持一致 */
}

/* 响应式调整 */
@media (max-width: 1400px) {
    .form-row {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
}

@media (max-width: 1000px) {
    .form-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* 2列布局的响应式调整 */
@media (max-width: 768px) {
    .form-row-2 {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input[readonly] {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
    border-color: #dee2e6;
}

.form-group input[readonly]:focus {
    border-color: #dee2e6;
    box-shadow: none;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.85rem;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(240, 147, 251, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 15px 30px;
    font-size: 1.1rem;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(79, 172, 254, 0.3);
}

.btn-info {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    padding: 15px 30px;
    font-size: 1.1rem;
}

.btn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.analysis-section {
    text-align: center;
    margin: 30px 0;
}

.analysis-section .btn {
    margin: 0 10px;
}

.plans-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

.plan-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    border-top: 5px solid #28a745;
}

.plan-section h3 {
    color: #28a745;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.3rem;
}

.title-info {
    color: #666;
    font-size: 0.85rem;
    font-weight: normal;
    margin-left: 8px;
}

.plan-content {
    max-height: 350px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.plan-content.expanded {
    max-height: none;
}

/* 收起状态时，表格高度自适应，无需滚动 */
.plan-content:not(.expanded) {
    max-height: none;
    overflow-y: visible;
}

.plan-controls {
    text-align: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.expand-btn {
    background: transparent;
    border: 2px solid #007bff;
    color: #007bff;
    padding: 8px 20px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.expand-btn:hover {
    background: #007bff;
    color: white;
    transform: translateY(-1px);
}

.expand-icon {
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.expand-btn.expanded .expand-icon {
    transform: rotate(180deg);
}

.no-data {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px 20px;
}

.repayment-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.repayment-table th,
.repayment-table td {
    padding: 8px 6px;
    text-align: center;
    border-bottom: 1px solid #ddd;
}

.repayment-table th {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.repayment-table tr:nth-child(even) {
    background: #f2f2f2;
}

.repayment-table tr:hover {
    background: #e3f2fd;
}

.total-row {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border-top: 2px solid #667eea;
}

.total-row:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
}

.total-row td {
    padding: 15px 8px;
    text-align: center;
    font-weight: bold;
    color: #495057;
    font-size: 1.05rem;
    border-bottom: none;
}

.summary-box {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.summary-item:last-child {
    border-bottom: none;
    font-weight: bold;
    color: #667eea;
    font-size: 1.1rem;
}





.comparison-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    border-top: 5px solid #667eea;
}

.comparison-data {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
}

.comparison-data h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.3rem;
    font-weight: bold;
}

.comparison-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #28a745;
    margin-bottom: 10px;
}

.comparison-value.negative {
    color: #dc3545;
}

/* 数据行布局 */
.data-row {
    display: flex;
    gap: 20px;
    justify-content: space-between;
}

.data-item {
    flex: 1;
    text-align: center;
}

.comparison-desc {
    color: #666;
    font-size: 1rem;
}

.comparison-method {
    padding: 20px;
    background: linear-gradient(135deg, #e8f5e8 0%, #d4edda 100%);
    border-radius: 10px;
}

.comparison-method strong {
    color: #28a745;
    font-size: 1.1rem;
    display: block;
    margin-bottom: 12px;
    font-weight: bold;
}



@media (max-width: 768px) {
    .plans-container {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 10px;
    }
    
    .main-content {
        padding: 20px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .comparison-group {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 20px;
    }
    
    .comparison-data,
    .comparison-method {
        padding: 15px;
    }
    
    .comparison-value {
        font-size: 2rem;
    }
    
    .data-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .data-item {
        flex: none;
    }
}

/* 计算方法说明区域样式 */
.calculation-methods {
    background: linear-gradient(135deg, #e8f5e8 0%, #d4edda 100%);
    border-radius: 15px;
    padding: 25px;
    margin-top: 30px;
}

.calculation-methods h4 {
    color: #28a745;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.3rem;
    font-weight: bold;
}

.method-item {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.method-item:last-child {
    margin-bottom: 0;
}

.method-item strong {
    color: #28a745;
    font-size: 1.1rem;
    display: block;
    margin-bottom: 8px;
}

.formula {
    background: #f8f9fa;
    padding: 8px 12px;
    margin: 8px 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #495057;
}

.detail {
    color: #666;
    font-size: 0.85rem;
    margin-top: 5px;
    padding-left: 12px;
}


